1 Public Class FrmSuppliersList
2
3     Private Sub FrmSuppliersList_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
4         MDIDISABLED()
5     End Sub
6     Private Sub FrmSuppliers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
7         
'(suppname, suppadd, suppcontact, contactperson)
8         rbsuplist.Checked = True
9         lstSuppliers.Visible = False
10         lstSupplies.Visible = False
11         PictureBox2.Visible = False
12         Label4.Visible = False
13         lstsupplier.Visible = True
14         
' FillListView(ExecuteSQLQuery("select Supp_ID as 'Supplier ID', replace(replace(suppname,'$.$',''''),'$..$',',') as 'Supplier Name', replace(replace(suppadd,'$.$',''''),'$..$',',') as 'Address', replace(replace(suppcontact,'$.$',''''),'$..$',',') as 'Contact No', replace(replace(contactperson,'$.$',''''),'$..$',',') as 'Contact Person' FROM tbl_suppliers ORDER BY suppName"), lstsupplier, 0)
15         Audit_Trail(xUser_ID, TimeOfDay,
"View Suppliers Profile")
16     End Sub
17
18     Private Sub CmdSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSearch.Click
19         If rbsuplist.Checked Then
20             sqlSTR =
"SELECT Supp_ID as 'Supplier ID', replace(replace(suppname,'$.$',''''),'$..$',',') as 'Supplier Name', replace(replace(suppadd,'$.$',''''),'$..$',',') as 'Address', replace(replace(suppcontact,'$.$',''''),'$..$',',') as 'Contact No', replace(replace(contactperson,'$.$',''''),'$..$',',') as 'Contact Person' " & _
21                      
"FROM TBL_Suppliers " & _
22                      
"WHERE replace(replace(suppname,'$.$',''''),'$..$',',') LIKE '%" & R_eplace(txtname.Text) & "%' ORDER BY suppName"
23             FillListView(ExecuteSQLQuery(sqlSTR), lstsupplier,
0)
24         Else
25             sqlSTR =
"SELECT Supp_ID as 'Supplier ID', suppName as 'Supplier Name', suppadd as 'Address', suppcontact as 'Contact No', ContactPerson as 'Contact Person' " & _
26                      
"FROM tbl_suppliers " & _
27                      
"WHERE SuppName LIKE '%" & txtname.Text & "%'"
28             FillListView(ExecuteSQLQuery(sqlSTR), lstSuppliers,
0)
29         End If
30
31         grpCat.Visible = False
32     End Sub
33
34     Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click
35         grpCat.Visible = False
36     End Sub
37
38     Private Sub FrmSuppliersList_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
39         With Me
40
41
42
43             GroupBox1.Width = (.Width - (MDIMain.TSHoldRight.Width /
2)) + 60
44             GroupBox1.Height = .Height - (MDIMain.TSHoldAdvisory.Height +
45)
45             .lstsupplier.Width = GroupBox1.Width -
10
46             .lstsupplier.Height = GroupBox1.Height -
18
47
48             
'for suppliers product(s)
49             .lstSuppliers.Width = GroupBox1.Width -
14
50             .lstSupplies.Width = GroupBox1.Width -
36
51             .lstSupplies.Height = (GroupBox1.Height - lstSuppliers.Height) -
60
52
53             .rbsuppro.Left = (GroupBox1.Left + GroupBox1.Width) - (.rbsuppro.Width)
54             .rbsuplist.Left = (.lstsupplier.Width - .rbsuppro.Width) -
96
55
56             
'.RBALL.Left = (GroupBox1.Left + GroupBox1.Width) - (.RBALL.Width)
57             
'.rbcatitemlist.Left = (.RBALL.Left - .rbcatitemlist.Width) - 2
58             
'.RBCat.Left = (.rbcatitemlist.Left - .RBCat.Width) - 2
59             
'.RBGroup.Left = (.RBCat.Left - .RBGroup.Width) - 2
60             
'MsgBox(rbsuplist.Left)
61             
'MsgBox(lstsupplier.Width - .rbsuppro.Left)
62         End With
63
64     End Sub
65
66
67     Private Sub cmdcncel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
68
69     End Sub
70
71     Private Sub txtname_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtname.KeyDown
72         If e.KeyCode =
13 Then
73             CmdSearch_Click(
0, AcceptButton)
74         End If
75     End Sub
76
77     Private Sub txtname_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtname.MouseDown
78
79     End Sub
80
81     Private Sub txtname_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtname.TextChanged
82
83     End Sub
84
85     Private Sub rbsuplist_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbsuplist.CheckedChanged
86         If rbsuplist.Checked Then
87             With MDIMain
88                 .cmdEdit.Enabled = True
89                 .cmdHome.Enabled = True
90                 .cmdNew.Enabled = True
91                 .cmdDelete.Enabled = True
92                 .cmdRefresh.Enabled = True
93             End With
94             lstSuppliers.Visible = False
95             lstSupplies.Visible = False
96             PictureBox2.Visible = False
97             Label4.Visible = False
98             lstsupplier.Visible = True
99             FillListView(ExecuteSQLQuery(
"select Supp_ID as 'Supplier ID', replace(replace(suppname,'$.$',''''),'$..$',',') as 'Supplier Name', replace(replace(suppadd,'$.$',''''),'$..$',',') as 'Address', replace(replace(suppcontact,'$.$',''''),'$..$',',') as 'Contact No', replace(replace(contactperson,'$.$',''''),'$..$',',') as 'Contact Person' FROM tbl_suppliers ORDER BY suppName"), lstsupplier, 0)
100
101         End If
102     End Sub
103
104     Private Sub rbsuppro_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbsuppro.CheckedChanged
105         If rbsuppro.Checked Then
106             With MDIMain
107                 .cmdEdit.Enabled = False
108                 .cmdHome.Enabled = True
109                 .cmdNew.Enabled = False
110                 .cmdDelete.Enabled = False
111                 .cmdRefresh.Enabled = True
112
113             End With
114             FillListView(ExecuteSQLQuery(
"select Supp_ID as 'Supplier ID', suppName as 'Supplier Name', Replace(Replace(suppadd,'$.$',''''),'$..$',',') as 'Address', suppcontact as 'Contact No', ContactPerson as 'Contact Person' FROM tbl_suppliers ORDER BY suppName ASC"), lstSuppliers, 1)
115             lstSuppliers.Visible = True
116             lstSupplies.Visible = True
117             PictureBox2.Visible = True
118             Label4.Visible = True
119             lstsupplier.Visible = False
120         End If
121     End Sub
122
123     Private Sub lstSuppliers_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstSuppliers.Click
124         sqlSTR =
"SELECT Item_ID as 'ID', Replace(Replace(Item_Name,'$.$',''''),'$..$',',') as 'Name', Item_Description as 'Description / Item Number' FROM TBL_Category_Item_File, TBL_Category_File WHERE TBL_Category_Item_File.Item_ID IN " & _
125                  
"(SELECT TBL_Suppliers_Product.Item_ID FROM TBL_Suppliers_Product WHERE Supp_ID = " & lstSuppliers.FocusedItem.Text & ") AND TBL_Category_File.Catg_ID = TBL_Category_Item_File.Catg_ID " & _
126                  
" ORDER BY Item_Name ASC"
127         FillListView(ExecuteSQLQuery(sqlSTR), lstSupplies,
0)
128     End Sub
129
130     Private Sub lstSuppliers_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstSuppliers.SelectedIndexChanged
131
132     End Sub
133
134     Private Sub grpCat_Enter(sender As Object, e As EventArgs) Handles grpCat.Enter
135
136     End Sub
137 End Class


Gõ tìm kiếm nhanh...